import time
from openpyxl import load_workbook
from openpyxl.styles import Alignment, Side, PatternFill, Border
from openpyxl.utils import get_column_letter
import re
from openpyxl import Workbook
from tqdm import tqdm

wb = load_workbook("C:/Users/10352/Desktop/2023.09-11提货-需求差异.xlsx")
ws = wb.active

list1 = [9, 13, 17, 21, 25, 29]
for i in tqdm(range(3, ws.max_row + 1)):
    print(i)
    for j in list1:
        # if ws.cell(i, j - 2).value > 0:
        #     ws.cell(i, j).value = ws.cell(i, 4).value
        #     while ws.cell(i, j).value < ws.cell(i, j - 2).value:
        #         ws.cell(i, j).value += ws.cell(i, 5).value
        if ws.cell(i, j - 3).value > 0:
            if abs(ws.cell(i, j - 2).value - ws.cell(i, j - 1).value) < ws.cell(i, j - 1).value * 0.3:
                ws.cell(i, j).value = "正常"
            else:
                ws.cell(i, j).value = "异常"

wb.save("C:/Users/10352/Desktop/2023.09-11提货-需求差异.xlsx")
